<?php 
header ( 'content-type:text/html; charset=utf-8' );
session_start ();
?>
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
	charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
         <script src="js/html5shiv.js"></script>
         <script src="js/respond.min.js"></script>
      <![endif]-->
</head>
<style>
	body{
	 background-color:pink;
	}
</style>
<body>
	<nav class="navbar navbar-default">
		<div class="container">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed"
					data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
					<span class="sr-only">切换</span> <span class="icon-bar"></span> <span
						class="icon-bar"></span> <span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="/th4.php">点餐系统</a>
			</div>
			<div class="collapse navbar-collapse"
				id="bs-example-navbar-collapse-1">
				<ul class="nav navbar-nav">
					<li class="dropdown"><a href="#" class="dropdown-toggle"
						data-toggle="dropdown">订单管理 <span class="caret"></span></a>
						<ul class="dropdown-menu">
							<li><a href="dinglie.php">订单列表</a></li>
							<li><a href="dingji.php">订单记录</a></li>
						</ul></li>
				</ul>
				<ul class="nav navbar-nav">
					<li class="dropdown"><a href="#" class="dropdown-toggle"
						data-toggle="dropdown">菜品管理 <span class="caret"></span></a>
						<ul class="dropdown-menu">
							<li><a href="jcp.php">添加菜品</a></li>
							<li><a href="cpl.php">菜品列表</a></li>
							<li class="divider"></li>
							<li><a href="jcx.php">添加菜品类型</a></li>
							<li><a href="cplie.php">菜品类型列表</a></li>
						</ul></li>
				</ul>
				<ul class="nav navbar-nav">
					<li class="dropdown"><a href="#" class="dropdown-toggle"
						data-toggle="dropdown">餐桌管理 <span class="caret"></span></a>
						<ul class="dropdown-menu">
							<li><a href="jiazhuo.php">添加餐桌</a></li>
							<li><a href="canzl.php">餐桌列表 </a></li>
						</ul></li>
				</ul>
				<ul class="nav navbar-nav">
					<li class="dropdown"><a href="#" class="dropdown-toggle"
						data-toggle="dropdown">登录管理 <span class="caret"></span></a>
						<ul class="dropdown-menu">
							<li><a href="#" data-toggle="modal" data-target="#aboutModal">关于点餐系统</a></li>
							<li><a href="xiugai.php">修改登录信息</a></li>
							<li><a href="#tui" data-toggle="modal">退出登录</a></li>
						</ul></li>
				</ul>
				<ul class="nav navbar-nav">
					<li class="dropdown"><a href="#" class="dropdown-toggle"
						data-toggle="dropdown">个人中心<span class="caret"></span></a>
						<ul class="dropdown-menu">
							<li><a href="yu.php">账户详情</a></li>
						</ul></li>
				</ul>
			</div>
		</div>
		<div class="modal fade" id="aboutModal" tabindex="-1">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span>&times;</span><span class="sr-only">Close</span>
						</button>
						<h4 class="modal-title">关于皇子大酒店点餐系统</h4>
					</div>
					<div class="modal-body">
						本皇子大酒店，精选优质渣料，<br> 选用上等地沟油，所有汤均用高级洗脚水熬制一天一夜而成。<br>
						各位顾客可放心点餐，我们还有优质的售后服务。<br> 我们保证在顾客吃后负责挖坑，免除顾客的后顾之忧。<br>
						最后，感谢各位顾客的光临，我们的酒店因你而生辉。

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-warning" data-dismiss="modal">确定</button>
					</div>
				</div>
			</div>
		</div>
		<div class="modal fade" id="tui" tabindex="-1">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span>&times;</span><span class="sr-only">Close</span>
						</button>
						<h4 class="modal-title">确定退出登录</h4>
					</div>
					<div class="modal-body">你确定要退出登录吗？</div>
					<div class="modal-footer">
						<a type="button" class="btn btn-default" href="tui.php">确定</a>
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>
	</nav>
	<?php 
	$pdo=new PDO('mysql:dbname=can;charset=utf8','root');
	
	$s=$pdo->prepare('select * from yu');
	$s->execute(array());
	$y=$s->fetch(PDO::FETCH_NAMED);
// 	var_dump($y);
	?>
	<?php 
	@$ka=$_REQUEST['kaid'];
	@$mi=$_REQUEST['mi'];
	
	
	if ($mi!=$y['fu']){
		if (!empty($ka)){
			$message = "解绑失败,支付密码错误";
		}
	}else {
		$s=$pdo->prepare('delete from ka where id=:kaid');
		if ($s->execute(array('kaid'=>$ka))){
			if (!empty($ka)){
				$message = "解绑成功";
			}
		}
	}
	?>
	<?php 
	@$zhifu=$_REQUEST['fu'];
	@$newfu=$_REQUEST['newfu'];
	
	if ($zhifu!=$y['fu']){
		if (!empty($zhifu)){
			$message = "原支付密码错误，请重新输入。";
		}
	}else {
		$s=$pdo->prepare('update yu set fu=:newfu where id=1');
		if ($s->execute(array('newfu'=>$newfu))){
			if (!empty($zhifu)){
				$message = "修改成功";
			}
		}
	}
	
	?>
	<?php 
	@$cao=$_REQUEST['caoid'];
	
	$s=$pdo->prepare('select * from jilu');
	$s->execute(array());
	$user=$s->fetchAll(PDO::FETCH_NAMED);
// 	var_dump($user);
	?>

	<?php 
	
	$s=$pdo->prepare('select *,ka.id as kaId from ka join xing on ka.xingId=xing.id');
	$s->execute(array());
	$k=$s->fetchAll(PDO::FETCH_NAMED);
// 	var_dump($k);
	?>
	<?php 
	
	$s=$pdo->prepare('select * from xing');
	$s->execute(array());
	$x=$s->fetchAll(PDO::FETCH_NAMED);
// 	var_dump($x);
	?>
	<div class="container">
		<div class="row">
		<div class="col-sm-3 col-md-2 page-left">
			<a class="btn btn-success btn-block" href="th4.php">返回主页</a>
		</div>
		<div class="col-sm-8 col-md-6 col-lg-5">
		<?php if (! empty ( $message )) { ?>
					<div class="alert alert-danger"><?php echo $message;?> <a
						class="close" data-dismiss="alert">&times;</a>
				</div>
					<?php } ?>
		<div class="panel panel-primary">
			<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 个人中心
				</h1>
			</div>
			<div class="panel-body">
			<div class="row">
<!-- 				<div class="a"><h3>　亲爱的的顾客，欢迎光临皇子大酒店，在这里你可以管理（查询‘充值’提现）你的一切资金。</h3></div> -->
<!-- 				<br><br><br> -->
				<h4>　账户余额为：<span style="color: #63B8FF"><?php  echo $y['yu']?></span>　　<a href="yu.php<?php echo '?caoid=4'?>">余额详情</a></h4>
				<h4>　<a href="yu.php<?php echo '?caoid=1'?>">账户充值</a></h4>
				<h4>　<a href="yu.php<?php echo '?caoid=2'?>">账户提现</a></h4>
				<h4>　<a href="yu.php<?php echo '?caoid=6'?>">管理银行卡</a></h4>
				<h4>　<a href="yu.php<?php echo '?caoid=5'?>">添加新银行卡</a></h4>
				<h4>　<a href="yu.php<?php echo '?caoid=3'?>">修改支付密码</a></h4>
			</div>
			</div>
		</div>
		<div class="panel panel-primary">
		<?php if(empty($cao)){?>
			<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 尊敬的顾客
				</h1>
			</div>
			<div class="panel-body">
			<div class="row">
			<div align="center">
				<img alt="" style="height: 200px;" src="png/01.gif" />
			</div>
			</div>
			</div>
			<?php }else { if ($cao==1){?>
			<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 充值
				</h1>
			</div>
			<div class="panel-body">
			<form action="chong.php" method="post" class="form-horizontal" >
			<div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">充值金额：</label>
                        <div class="col-sm-9">
                            <input name="yu" value="" class="form-control" placeholder="请输入充值金额">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">选择银行卡</label>
                        <div class="col-sm-9">
                            <select name="card" class="form-control">
                            <?php for($b=0;$b<count($k);$b++){?>
                            <option value="<?php echo $k[$b]['kaId']?>"><?php echo $k[$b]['card'];?>　(<?php echo $k[$b]['xin']?>)</option>
                            <?php }?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">支付密码：</label>
                        <div class="col-sm-9">
                            <input name="fu" value="" type="password" class="form-control" placeholder="请输入支付密码">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-offset-3 col-sm-4">
                            <button class="btn btn-primary btn-block" type="submit">充值</button>
                        </div>
                    </div>
                    </form>
			</div>
			</div>
			<?php }else { if ($cao==2){?>
				<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 提现
				</h1>
			</div>
			<div class="panel-body">
			<form action="ti.php" method="post" class="form-horizontal" >
			<div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">选择银行卡</label>
                        <div class="col-sm-9">
                            <select name="card" class="form-control">
                            <?php for($b=0;$b<count($k);$b++){?>
                            <option value="<?php echo $k[$b]['kaId']?>"><?php echo $k[$b]['card'];?>　(<?php echo $k[$b]['xin']?>)</option>
                            <?php }?>
                            </select>
                        </div>
                    </div>
			<div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">提现金额</label>
                        <div class="col-sm-9">
                            <input name="yu" value="" class="form-control" placeholder="可提现金额最多为： <?php  echo $y['yu']?> 元">
                        </div>
                    </div>
            <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">支付密码：</label>
                        <div class="col-sm-9">
                            <input name="fu" value="" type="password" class="form-control" placeholder="请输入支付密码">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-offset-3 col-sm-4">
                            <button class="btn btn-primary btn-block" type="submit">确定</button>
                        </div>
                    </div>
                    </form>
			</div>
			</div>
			<?php } else {
				if ($cao==3){?>
			<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 修改支付密码
				</h1>
			</div>
			<div class="panel-body">
			<form action="yu.php" method="post" class="form-horizontal" >
            <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">原支付密码：</label>
                        <div class="col-sm-9">
                            <input name="fu" value="" type="password" class="form-control" placeholder="请输入原支付密码">
                        </div>
                    </div>
            <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">新支付密码：</label>
                        <div class="col-sm-9">
                            <input name="newfu" value="" type="password" class="form-control" placeholder="请输入新支付密码">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-offset-3 col-sm-4">
                            <button class="btn btn-primary btn-block" type="submit">确定</button>
                        </div>
                    </div>
                    </form>
			</div>
			</div>
				<?php }else { if ($cao==4){?>
					<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 余额详情
				</h1>
			</div>
			<table class="table table-striped table-bordered table-hover">
			<tr>
				<th>时间</th><th>金额</th><th>动作</th>
			</tr>
			<?php for ($a=0;$a<count($user);$a++){?>
			<tr>
				<td><?php echo $user[$a]['jian']?></td>
				<td><?php echo $user[$a]['shi']?><span><?php echo $user[$a]['jin']?></span></td>
				<?php if ($user[$a]['bie']==1){?>
				<td>充值</td>
				<?php }else { if ($user[$a]['bie']==2){?>
				<td>提现</td>
				<?php }else {?>
				<td>消费</td>
				<?php }}?>
			</tr>
			<?php }?>
			</table>
			</div>
				<?php }else {
				if ($cao==5){?>
			<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 添加银行卡
				</h1>
			</div>
			<div class="panel-body">
			<form action="yin.php" method="post" class="form-horizontal" >
            <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">新银行卡：</label>
                        <div class="col-sm-9">
                            <input name="card" value="" class="form-control" placeholder="请输入银行卡号">
                        </div>
                    </div>
            <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">选择银行卡运营商</label>
                        <div class="col-sm-9">
                            <select name="xin" class="form-control">
                            <?php for($b=0;$b<count($x);$b++){?>
                            <option value="<?php echo $x[$b]['id']?>"><?php echo $x[$b]['xin'];?></option>
                            <?php }?>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-offset-3 col-sm-4">
                            <button class="btn btn-primary btn-block" type="submit">确定</button>
                        </div>
                    </div>
                    </form>
			</div>
				<?php }else { 
				if ($cao==6){?>
			<div class="panel-heading">
				<h1 class="panel-title">
					<span class="glyphicon glyphicon-user"></span> 管理银行卡
				</h1>
			</div>
			<table class="table table-striped table-bordered table-hover">
			<tr>
				<th>卡号</th>
				<th>卡种</th>
				<th>选项</th>
			</tr>
			<?php for($b=0;$b<count($k);$b++){?>
			<tr>
				<td><?php echo $k[$b]['card']?></td>
				<td><?php echo $k[$b]['xin']?></td>
				<td><a data-toggle="modal" data-target="<?php echo "#jiebang".$b;?>">解绑</a>
				<div class="modal fade" id="<?php echo 'jiebang'.$b;?>">
					<div class="modal-dialog">
						<div class="modal-content">
						<form action="yu.php<?php echo '?kaid='.$k[$b]['kaId']?>" method="post" class="form-horizontal" >
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal">
									<span>&times;</span><span class="sr-only">Close</span>
								</button>
								<h4 class="modal-title">解绑确认</h4>
							</div>
							<div class="modal-body">
								<div class="form-group">
								<label class="control-label col-sm-1 hidden-xs"></label>
								<div class="col-sm-9">
								<h4>你确定要解绑
								 <span style="color: blue"><?php echo $k[$b]['card']?>
								</span>
								银行卡吗？</h4>
								</div>
								</div>
								<div class="form-group">
			                        <label class="control-label col-sm-3 hidden-xs">支付密码：</label>
			                        <div class="col-sm-9">
			                            <input name="mi" value="" type="password" class="form-control" placeholder="请输入支付密码">
			                        </div>
			                    </div>
							</div>
							<div class="modal-footer">
								<button type="submit" class="btn btn-danger">确定</button>
								<button type="button" class="btn btn-default"
									data-dismiss="modal">取消</button>
							</div>
							</form>
						</div>
					</div>
				</div></td>
			</tr>
			<?php }?>
			</table>
				<?php }
				}
				}
				}
			}
			
	}
	}?>
</body>
</html>